#include <cstdio>
#include <cstring>

int main( )
{
    char p[ 2 ], sd[ 201 ];
    int i, l, c;
    while ( scanf("%s%s", p, sd) != EOF )
    {
        c = 0;
        l = strlen( sd );
        if ( p[ 0 ] >= 'A' && p[ 0 ] <= 'Z' )
            p[ 0 ] = p[ 0 ] - 'A' + 'a';
        for ( i = 0; i < l; i++ )
        {
            if ( sd[ i ] >= 'A' && sd[ i ] <= 'Z' )
                sd[ i ] = sd[ i ] - 'A' + 'a';
            if ( sd[ i ] == p[ 0 ] )
                c++;
        }
        printf("%.5lf\n", double( c ) / l);
    }
    return 0;
}
